/*
* Copyright (C) 2020 ~ 2024 chaigec All Rights Reserved.
*
* Author:     chaigec <chaigec@163.com>
* Maintainer: chaigec <chaigec@163.com>

 * Use of this source code is governed by MIT license that can be found in the
 * LICENSE file in the root of the source tree. All contributing project authors
 * may be found in the AUTHORS file in the root of the source tree.
*/

#ifndef MK_PS_STREAM_SOURCE_H
#define MK_PS_STREAM_SOURCE_H
#include "MkMedia/MkMediaSource.h"

class CMkPsDemuxer;
class MkApi CMkPsStreamSource : public CMkMediaSource
{
public:
    CMkPsStreamSource();
    virtual ~CMkPsStreamSource();

    Uint32 InputDataSlice(const Uint8* pBuf, Uint32 nLen, Uint32 TimeStamp, BOOL bEndSlice = FALSE);
    Uint32 InputData(Uint8* pBuf, Uint32 nLen, Uint32& nUsed);
    Uint32 InputPsPacket(Uint8* pBuf, Uint32 nLen);

    const CMkAudioParam& GetAudioParam() const override;
    const CMkVideoParam& GetVideoParam() const override;
protected:
    //Uint32 Stop() override;
private:
    Uint32 CallbackEsPacket();
private:
    CMkPsDemuxer    *m_pPsDemuxer;
    Uint8           *m_pBuf;
    Uint32          m_MaxLen;
    Uint32          m_nOffset;
    Uint32          m_LastTimeStamp;
};


#endif